package base.util;

import base.cache.CacheManager;
import org.apache.log4j.Logger;
import em.util.ConstUtil;

import java.util.HashMap;

/**
 * 配置文件config.properties所有配置
 */
public class PropertiesContent {
	public Logger log = Logger.getLogger(PropertiesContent.class);

	public static String get(String key){
		HashMap hm= CacheManager.getInstance().get(ConstUtil.CACHE_KEY_PROPERTIES);
		return (String)hm.get(key);
	}
	public static String get(String key, String def) {
		String v=get(key);
		if(v==null){
			return def;
		}else{
			return v;
		}
	}

	public static Boolean getToBool(String key,Boolean def){
		try{
			return Boolean.valueOf(get(key));
		}catch(Exception e){
			return def;
		}
	}
	public static Integer getToInteger(String key,Integer def){
		try{
			return Integer.valueOf(get(key));
		}catch(Exception e){
			return def;
		}
	}
}
